package com.qiyang.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;

import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 *
 */
public class User {

    private Integer id;

    private String name;

    private String [] alias; // 外号

    private List<String> hobbies; // 爱好

    private Map<String, String> relatives; // 亲属

    private Role role;

    private List<User> firends;

    /**
     * JsonIgnore 忽略属性
     */
    @JsonIgnore
    private String password;

    /**
     * JsonFormat 格式化
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date birthday;

    public User(Integer id, String name, String[] alias, List<String> hobbies, Map<String, String> relatives, Role role, List<User> firends) {
        this.id = id;
        this.name = name;
        this.alias = alias;
        this.hobbies = hobbies;
        this.relatives = relatives;
        this.role = role;
        this.firends = firends;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String[] getAlias() {
        return alias;
    }

    public void setAlias(String[] alias) {
        this.alias = alias;
    }

    public List<String> getHobbies() {
        return hobbies;
    }

    public void setHobbies(List<String> hobbies) {
        this.hobbies = hobbies;
    }

    public Map<String, String> getRelatives() {
        return relatives;
    }

    public void setRelatives(Map<String, String> relatives) {
        this.relatives = relatives;
    }

    public Role getRole() {
        return role;
    }

    public void setRole(Role role) {
        this.role = role;
    }

    public List<User> getFirends() {
        return firends;
    }

    public void setFirends(List<User> firends) {
        this.firends = firends;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", alias=" + Arrays.toString(alias) +
                ", hobbies=" + hobbies +
                ", relatives=" + relatives +
                ", role=" + role +
                ", firends=" + firends +
                '}';
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
}
